
<div class="order-list-page" ng-if="pagedata.op == 'list'">
    <div class="fui-header">
		<div class="fui-header-left" ng-click="goback()">
            <a class="back"></a>
        </div>
		<div class="title">我的预约</div>
		<div class="fui-header-right"></div>
	</div>
	<div id="tab" class="fui-tab fui-tab-danger">
        <a ng-class="{'external active':pagedata.params.status ==100}" href="javascript:" ng-click="pagedata.params.status=100;tool.get_list('jy_shopbaoxiu/fuwu.order/list/',true);">全部</a>
        <a ng-class="{'external active':pagedata.params.status == 0}" href="javascript:" ng-click="pagedata.params.status=0;tool.get_list('jy_shopbaoxiu/fuwu.order/list/',true);">待付款</a>
        <a ng-class="{'external active':pagedata.params.status == 1}" href="javascript:" ng-click="pagedata.params.status=1;tool.get_list('jy_shopbaoxiu/fuwu.order/list/',true);">已付款</a>
        <a ng-class="{'external active':pagedata.params.status == 2}" href="javascript:" ng-click="pagedata.params.status=2;tool.get_list('jy_shopbaoxiu/fuwu.order/list/',true);">待处理</a>
        <a ng-class="{'external active':pagedata.params.status == 3}" href="javascript:" ng-click="pagedata.params.status=3;tool.get_list('jy_shopbaoxiu/fuwu.order/list/',true);">已取消</a>
        <a ng-class="{'external active':pagedata.params.status == 4}" href="javascript:" ng-click="pagedata.params.status=4;tool.get_list('jy_shopbaoxiu/fuwu.order/list/',true);">已完成</a>
    </div>
	<div class='fui-content order-list' style="margin-top:4.5rem">
	<div class="fui-list-group order-item" ng-repeat="item in pagedata.list">
                <a class="fui-list external" style="padding: 0.42rem 0.5rem" data-nocache="true">
                    <div class="fui-list-inner">
                        <div class="subtitle"> 预约号: {{item.selfnumber || item.ordersn}}</div>
                    </div>
                    <div class="row-remark text-cancel" style="font-size: 0.65rem;text-align: right;">{{item.statustitle}}</div>
                    <div class="angle"></div>
                </a> 
				<div ng-if="item.shifuinfo.baobeimsg" style="line-height:1.4;color:#999;font-size:0.65rem;padding: 0.2rem 0.5rem"><i class="icon icon-warning"></i> 异常原因： <span class="text-danger">{{item.shifuinfo.baobeimsg || '无'}}  </span></div>
                   <div class="fui-list-group-title lineblock">
                          {{item.serve_title || '预约项目'}}
                          <span class="status noremark" style="font-size:0.60rem"><span style="color:#f60;">{{item.typetitle || '上门服务'}}</span></span>
                    </div>
					 <div ng-if="item.storeid>0" class="fui-list-group-title lineblock">
                            <i class="icon jinyunicon icon-dianpu"></i> {{item.store.title || '就近门店'}}
                            <span class="status noremark" style="font-size:0.50rem">
							<span style="color:#f60;margin-right:0.5rem">{{item.store.address}}</span>
							<a href="javascript:" ng-click="pagedata.openLocation(item.store);" style="color:red;"><i class="icon icon-lvyoutehui"></i>导航</a>
							</span>
                    </div>
                    <a href="" class="external" data-nocache="true" ng-click="access_json('jy_shopbaoxiu/fuwu.order/detail/id='+item.id)">
                        <div class="fui-list goods-list">
                            <div class="fui-list-media" style="">
                                <img class="" ng-src="{{tomedia(item.serve_image) || '../core/resource/images/nopic.jpg'}}">
                            </div>
                            <div class="fui-list-inner" style="height:auto">
                                <div class="text goodstitle towline">{{item.serve_title || '预约名称'}}</div>
								<div class="text" style="color:#f60;font-size:0.60rem">{{item.type==1?'到店时间':'上门时间'}}：{{item.serve_time}}</div>
								<div class="text" style="font-size:0.60rem">地址：{{item.address || '无'}}</div>
								<div class="subtitle" style="font-size:0.60rem">备注：{{item.remark || '无'}}</div>
                            </div>
   
                        </div>
                    </a>
					<div ng-if="item.shifuinfo.title" class="title" style="padding:0.2rem 0.5rem">
						<div><i class="icon icon-f13" style="font-size: 0.65rem"> 师傅：<span class="price red">{{item.shifuinfo.title}}</span>  <a class="price red">{{item.shifuinfo.mobile}}</a></i></div>
					</div>
                <div class="fui-list-group-title lineblock">
					<span style="color:#999;font-size:0.55rem"><i class="icon jinyunicon icon-shijian" style="color:#f60;font-size:0.50rem"></i> {{item.createtime}}</span>
                    <span class="status noremark"> {{item.yuejiemid>0?'月结下单':'现金实付'}} <span class="text-danger">￥{{item.payfee}}</span></span>
                </div>
            <div class="fui-list-group-title lineblock opblock">
				<span class="status noremark">
					<div ng-show="item.status == 0" class="btn btn-sm btn-default-o order-delete" href="javascript:" ng-click="post({},'del','id='+item.id)">删除预约</div>
					<div ng-show="item.status == 0" class="btn btn-sm btn-danger-o order-finish" href="javascript:" ng-click="pagedata.pay(item.id)">支付预约</div>
					<div ng-show="item.yuejiemid == 0 && item.ispay==0 && item.status == 10" class="btn btn-sm btn-danger-o order-finish" href="javascript:" ng-click="pagedata.paynew(item.id)">支付费用</div>
					<div ng-show="item.status == 2 || ((item.yuejiemid>0 || item.ispay==1)&& item.status == 10)" class="btn btn-sm btn-danger-o order-finish" href="javascript:" ng-click="post({},'receive','id='+item.id,'','确定已经完成服务了？')">完成服务</div>
					<div ng-show="item.status == 4" class="btn btn-sm btn-danger-o order-finish" href="javascript:" ng-click="access_json('/comment/commentorder/id='+item.id)">评价</div>
				</span>
            </div>
        </div>
	</div>
	<div class="content-empty" ng-show="pagedata.list.length == 0 ">
		  <i class="icon jinyunicon icon-cry" style="width: 6rem;margin-bottom: 0.5rem;"></i><br/><p style="color: #999;font-size: .75rem">您暂时没有订单！</p>
	</div>
</div>
<div class="fui-page cav order_detail" ng-if="pagedata.op == 'detail'">
	<link rel="stylesheet" type="text/css" href="../addons/jy_weishop/custom/templates/mobile/css/orderdetail.css?v=2.3">
    <div class="fui-header">
		<div class="fui-header-left" ng-click="goback()">
            <a class="back"></a>
        </div>
		<div class="title">预约详情</div>
		<div class="fui-header-right"></div>
	</div>
	<div class='fui-content'>
		<div class="order_header" style="padding-top: .76rem; margin-bottom: -.266667rem;">
			  <div class="red" style="width:2.6rem;margin:0 auto">
				<i ng-if="pagedata.order.status == 4" class="icon icon-wrong" style="font-size:2.6rem"></i>
				<i ng-if="pagedata.order.status == 3" class="icon icon-success" style="font-size:2.6rem"></i>
				<i ng-if="pagedata.order.status == 2 || pagedata.order.status == 1" class="icon icon-clock" style="font-size:2.6rem"></i>
			  </div>
			  <div class="order_detail_ststus" style="padding:0.3rem;background:none">
					<div class="bold">
						<div style="font-size: 0.85rem;">{{pagedata.order.statustitle}}</div>
					</div>
					<div class="subtitle">{{pagedata.order.statusdesc}}</div>
					<div ng-click="pagedata.show_verify(pagedata.order.selfnumberurl,pagedata.order.selfnumber)" class="bold red">预约码：{{pagedata.order.selfnumber}} <i class="icon icon-erweima" style="color:#333"></i></div>
			  </div>
		</div>
		<div ng-if="pagedata.order.shifuinfo.baobeimsg" style="line-height:1.4;color:#999;font-size:0.65rem;padding: 0 1rem"><i class="icon icon-warning"></i> 异常原因： <span class="text-danger">{{pagedata.order.shifuinfo.baobeimsg || '无'}}  </span></div>
		<div ng-if="pagedata.order.shifuinfo.title" class="title c" style="padding:0.2rem 1rem">
			<div><i class="icon icon-f13" style="font-size: 0.65rem"> 师傅：<span class="price red">{{pagedata.order.shifuinfo.title}}</span> <a href="tel:{{pagedata.order.shifuinfo.mobile}}" class="price red">{{pagedata.order.shifuinfo.mobile}}</a></i></div>
		</div>
		<div class="weui_btn_area" ng-show="pagedata.order.yuejiemid == 0 && pagedata.order.ispay==0 && pagedata.order.status == 10">
		 <a class="weui_btn weui_btn_primary" href="javascript:" ng-click="pagedata.paynew(pagedata.order.id)">支付费用</a>
		</div>
		<div class="weui_cells" style="margin-top:0.5rem">
			<div class="weui_cell">
					<div class="weui_cell_bd weui_cell_primary">
						<span>预约项目</span>
					</div>
					<div class="weui_cell_ft">{{pagedata.serve.title}}</div>
			</div>
			<div ng-if="pagedata.basic.isworker!=1 && pagedata.worker.name" class="weui_cell">
					<div class="weui_cell_bd weui_cell_primary">
						<span>预约技师</span>
					</div>
					<div class="weui_cell_ft" >{{pagedata.worker.name}}</div>
			</div>
			<div class="weui_cell">
					<div class="weui_cell_bd weui_cell_primary">
						<span>预约人</span>
					</div>
					<div class="weui_cell_ft" >{{pagedata.order.username}}</div>
			</div>
			<div class="weui_cell">
					<div class="weui_cell_bd weui_cell_primary">
						<span>联系电话</span>
					</div>
					<div class="weui_cell_ft" >{{pagedata.order.mobile}}</div>
			</div>
			<div class="weui_cell">
					<div class="weui_cell_bd weui_cell_primary">
						<span>预约时间</span>
					</div>
					<div class="weui_cell_ft">{{pagedata.order.serve_time}}</div>
			</div>
			<div class="weui_cells_title" style="padding-left:0.6rem">故障描述</div>
			<div class="weui_cell">
					<div class="weui_cell_bd weui_cell_primary">{{pagedata.order.remark}}</div>
			</div>
			<div class="weui_cell">
					<div class="weui_cell_bd weui_cell_primary">
						<span>故障图片</span>
					</div>
					<div class="weui_cell_ft">
						<div class="weui_uploader_bd" style="margin-bottom:0">
                            <ul class="weui_uploader_files" ng-click="previewImage(pagedata.order.images[0],pagedata.order.images);">
                                <li ng-repeat="p in pagedata.order.images" class="weui_uploader_file" style="background-image:url('{{tomedia(p)}}')"></li>
                            </ul>
                        </div>
					</div>
			</div>
			<div ng-if="pagedata.order.price>0" class="weui_cell">
					<div class="weui_cell_bd weui_cell_primary">
						<span>服务费用</span>
					</div>
					<div class="weui_cell_ft">{{pagedata.order.price}}元</div>
			</div>
			<div ng-if="pagedata.order.payfee>0" class="weui_cell">
					<div class="weui_cell_bd weui_cell_primary">
						<span>{{pagedata.order.yuejiemid>0?'月结下单':'现金实付'}} </span>
					</div>
					<div class="weui_cell_ft">{{pagedata.order.payfee}}元</div>
			</div>
			<div class="weui_cell" ng-repeat="item in pagedata.fileds">
					<div ng-if="item.type != 3" class="weui_cell_bd weui_cell_primary">
						<span>{{item.title}}</span>
					</div>
					<div ng-if="item.type != 3" class="weui_cell_ft" ng-model="pagedata.post.package_price">{{item.data}}</div>
					<div ng-if="item.type == 3" class="weui_cell_bd weui_cell_primary">
						<span>{{item.title}}</span>
					</div>
					 <a class="fui-list-media" ng-if="item.type == 3">
                    <img class="round" src="{{tomedia(item.data) || '../core/resource/images/nopic.jpg'}}" />
                </a>
			</div>
		</div>
		<div class="mask" ng-click="pagedata.close_verify()">
			<div class="code_box">
				<p>请将二维码出示给{{pagedata.order.sendtype==1?'配送员':'店员'}}</p>
				<div class="img_box" id="show_verify_ewm">
					
				</div>
				<div class="cav_code" id="show_verify_code"></div>
				<div class="error">
					<p style="padding: 0 1.3rem">温馨提示：为了更好的保护您利益,请不要轻易将您的核销二维码泄露给他人</p>
				</div>
			</div>
		</div>
	</div>
</div>
<div ng-include="sys_html('common/pluginnav',true)"></div>
<script type="text/javascript">
scope.tool.get_list('jy_shopbaoxiu/fuwu.order/list/',true);
scope.pagedata.scroll_bottom=function(){
		scope.tool.get_list('jy_shopbaoxiu/fuwu.order/list/');
}
scope.pagedata.pay=function(id){
	scope.post_json('jy_shopbaoxiu/fuwu.order/pay/',{'id':id},function(pay_id){
		scope.$evalAsync();
		scope.tool.pay(pay_id,function(res){
				if(res.type=='success'){
					scope.message('支付成功！','success','jy_shopbaoxiu/fuwu.order/');
				}else{
					scope.message('支付失败！','success','jy_shopbaoxiu/fuwu.order/');
				}
		});
	});
}
scope.pagedata.paynew=function(id){
	scope.post_json('jy_shopbaoxiu/fuwu.order/paynew/',{'id':id},function(pay_id){
		scope.$evalAsync();
		scope.tool.pay(pay_id,function(res){
				if(res.type=='success'){
					scope.message('支付成功！','success','jy_shopbaoxiu/fuwu.order/');
				}else{
					scope.message('支付失败！','success','jy_shopbaoxiu/fuwu.order/');
				}
		},'','','jy_shopbaoxiu/fuwu.order/');
	});
}
scope.pagedata.show_verify=function(url,code){
			scope.tool.qr(url,'show_verify_ewm',150)
			$('#show_verify_code').text(code);
			$('.mask').css({display:'block'});
}	
scope.pagedata.close_verify=function(url,code){
	$('.mask').css({display:'none'});
}
scope.pagedata.openLocation=function(item){
	var pcdaddress= item.pcd?item.pcd.province+item.pcd.city+item.pcd.district+item.pcd.street:'';
	var post={
		'address':pcdaddress+item.address,
		'city':item.pcd?item.pcd.city:''
	}
	scope.tool.get_latlng(post,function(res){
		console.log(res)
		var lat_lng = res.location
		var address_components = res.address_components
		wx.openLocation({
			latitude: lat_lng.lat, // 纬度，浮点数，范围为90 ~ -90
			longitude: lat_lng.lng, // 经度，浮点数，范围为180 ~ -180。
			name: pcdaddress, // 位置名
			address: item.address, // 地址详情说明
			scale: 20, // 地图缩放级别,整形值,范围从1~28。默认为最大
			infoUrl: '', // 在查看位置界面底部显示的超链接,可点击跳转
			success:function(){
				//alert(1111);
			},
			fail:function(res){
				scope.message('导航异常，可能是权限问题：'+res.errMsg);
			}
		});
	});
}
</script>